// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.ai.states;

import java.util.HashMap;
import zombie.ai.State;
import zombie.characters.IsoGameCharacter;
import zombie.characters.IsoPlayer;
import zombie.characters.Moodles.MoodleType;
import zombie.network.GameClient;

public final class PlayerGetUpState extends State {
    private static final PlayerGetUpState _instance = new PlayerGetUpState();

    public static PlayerGetUpState instance() {
        return _instance;
    }

    @Override
    public void enter(IsoGameCharacter owner) {
        HashMap hashMap = owner.getStateMachineParams(this);
        owner.setIgnoreMovement(true);
        IsoPlayer isoPlayer = (IsoPlayer)owner;
        isoPlayer.setInitiateAttack(false);
        isoPlayer.attackStarted = false;
        isoPlayer.setAttackType(null);
        isoPlayer.setBlockMovement(true);
        isoPlayer.setForceRun(false);
        isoPlayer.setForceSprint(false);
        owner.setVariable("getUpQuick", owner.getVariableBoolean("pressedRunButton"));
        if (owner.getMoodles().getMoodleLevel(MoodleType.Panic) > 1) {
            owner.setVariable("getUpQuick", true);
        }

        if (owner.getVariableBoolean("pressedMovement")) {
            owner.setVariable("getUpWalk", true);
        }

        if (GameClient.bClient) {
            owner.setKnockedDown(false);
        }
    }

    @Override
    public void execute(IsoGameCharacter owner) {
    }

    @Override
    public void exit(IsoGameCharacter owner) {
        owner.clearVariable("getUpWalk");
        if (owner.getVariableBoolean("sitonground")) {
            owner.setHideWeaponModel(false);
        }

        owner.setIgnoreMovement(false);
        owner.setFallOnFront(false);
        owner.setOnFloor(false);
        ((IsoPlayer)owner).setBlockMovement(false);
        owner.setSitOnGround(false);
    }
}
